package com.teacher.hong.entity;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * 学生类
 */
@Data
@Slf4j
public class Student {

    private Integer id;
    @NotBlank(message = "学生姓名不能为空")
    private String name;
    @NotNull(message = "班级ID不能为空")
    private Integer clazzId;
    private String clazzName;
    @NotNull(message = "性别不能为空")
    private String sex;

    @Max(value = 120, message = "年龄不能超过120")
    @NotNull(message = "年龄不能为空")
    private Short age;

    private String address;
    private LocalDateTime createtime;
    private int money;

    public Student() {
        log.debug("实例了一个Student对象...");
    }

    public Student(String name, Integer clazzId, String sex, short age, String address) {
        this.name = name;
        this.clazzId = clazzId;
        this.sex = sex;
        this.age = age;
        this.address = address;
    }

    public Student(Integer id, String name, Integer clazzId, String sex, short age, String address) {
        this.id = id;
        this.name = name;
        this.clazzId = clazzId;
        this.sex = sex;
        this.age = age;
        this.address = address;
    }

    public Student(String name, Integer clazzId, String sex, short age, String address, LocalDateTime createtime) {
        this.name = name;
        this.clazzId = clazzId;
        this.sex = sex;
        this.age = age;
        this.address = address;
        this.createtime = createtime;
    }

    public Student(Integer id, String name, Integer clazzId, String sex, short age, String address, LocalDateTime createtime) {
        this.id = id;
        this.name = name;
        this.clazzId = clazzId;
        this.sex = sex;
        this.age = age;
        this.address = address;
        this.createtime = createtime;
    }

    @Override
    public String toString() {
        return id +
                "\t" + name +
                "\t" + clazzName +
                "\t" + sex +
                "\t" + age +
                "\t" + address +
                "\t" + createtime;
    }
}
